home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RayLathe v 2.10 (c) 1993 Koehler
-
- DESCRIPTION:
-
- RayLathe is a text based tool that allows you to create three
- dimensional objects using the metaphor of the carpenter's lathe. The
- objects are created as #declare'd composite's for POVRAY 1.0 (p.k.a.
- DKB), POVRAY 2.0, or Vivid 2.0 ray tracing programs. This program also
- generates RAW (with and without color) triangle data for RAW2POV and
- SNDPPR (which smooth triangle data into ray tracer source).
-
- Imagine the 'stock' we are cutting lies along the X axis. We will
- be cutting from 0 X in the positive direction. POVRAY and Vivid output
- is designed to use cones (or cylinders if straight) to make the surface
- of each cut along the X axis. This is VERY CPU efficient to render.
- Unfortunatley curved surfaces show the seam between cuts. For this
- reason, v2.0 outputs in the RAW format. Instead of making a smooth
- cut around the 'stock', we are making a ring of triangles for each cut.
- Imagine a sphere versus a geodesic dome. RAW2POV and SNDPPR
- (SandPaper) both take this data and create 'smooth' triangles for
- various ray tracers.
-
- With version 2.0 of Raylathe, an optional header record describes
- the input data format and how many facets about the X axis are to be
- generated for RAW data. If the first number in the file is -1, then
- this is a header record with the third number in the file (second is
- ignored at this point) is the number of facets around the stock to cut
- for RAW data. This information is ignored for POVRAY & Vivid data
- formats. If the first number in the file is -2, this means the same as
- -1 plus all data after this record includes color information.
-
- The data is given as X Y THICK. If color information is included,
- then the format is RED GREEN BLUE X Y THICK. Please refer to examples
- at this point if the format confuses you. All numbers are floating
- point.
-
- X and Y are the coordinates of the end point of the line of a cut
- on the lathe. THICK is the thickness of the surface of the object.
- This obviously differs from a real lathe were the object is solid. We
- can, however, do things a real lathe can't: undercut an area. See
- example #2 below. The values for THICK are: -1 for POVRAY=solid /
- Vivid=paper-thing object (renders quickest, no undercutting allowed in
- POVRAY), 0 for 'move to' (like starting a new block of wood a distance
- from the current one), and anything greater than 0 for the actual
- thickness of the shell of the object. The last entry must be '-1 -1
- -1' to signify end of object. If color data is present the last line
- must be '-1 -1 -1 -1 -1 -1' for consistency. Comments may be added
- after this line.
-
-
-
-
- EXAMPLE #1
-
- We will make an object that looks like a pulley. Figure A shows
- the coordinates with lines showing the cut surface. Figure B is the
- data set for Figure A. Figure C is a view of the pulley looking into
- the groove.
-
- Fig. A Fig. B Fig. C
-
- 5 | * * 2 1 0 <-note move-to . .
- 4 | |\ /| 5 5 -1 |\ /|
- 3 | | *---* | 3 3 -1 | .---. |
- 2 | | | 5 3 -1 | |
- 1 | * * 6 5 -1 | |
- + - - - - - - - - - 6 1 -1 | |
- 0 1 2 3 4 5 6 7 8 9 -1 -1 -1 | .---. |
- |/ \|
- . .
- EXAMPLE #2
-
- Contrary to a real lathe, this lathe can undercut surfaces. For
- example we can make something that looks [barely] like a sun umbrella.
- Remember to use thickness when undercutting else the solid object will
- fill in the inside of the umbrella. Also, use a thickness of 0 when
- moving from the tip of the umbrella (point 3) into the center (point 4)
- when drawing the post (line between 4 and 5).
- Fig. D Fig. E
-
- 3 .
- / / !
- / / !
- / / !
- / / !
- 2 . !
- |4-----------------------------5 |-------------------------------
- 1 |-------------------------------
- . !
- \ !
- \ !
- \ !
- \ !
- .
- EXAMPLE #3
-
- This example uses the same data as used in Example #1, with the
- addition of color attributes.
-
- -2 -1 15 <- color record, unused, 15 sides around cut
- 2 1 0 2 1 0 1 0 0 <- Red
- 5 5 -1 5 5 -1 0.3 0.3 0.3 <- Dark Grey
- 3 3 -1 3 3 -1 1 1 1 <- White
- 5 3 -1 5 3 -1 0 0 1 <- Blue
- 6 5 -1 6 5 -1 0 1 0 <- Green
- 6 1 -1 6 1 -1 0 0 0 <- Black
- -1 -1 -1 -1 -1 -1 -1 -1 -1
-
-
-
-
-
- APPLICATION NOTES:
-
- Another program is included to convert uLathe (by Daniel S. Baker
- CompuServe: 71551,2300) .LAT files to .DAT files used by RayLathe to
- generate the objects. uLathe is an excellent object creator for
- windows. I was disappointed that the output was not usable by any of
- the ray tracers for building whole scenes. Ta-Da!
-
- The objects themselves are a series of cuts (the line between the
- specified points of data). uLathe presents each cut as a number of
- flat facets about the X axis. For ray tracing, multiply the number of
- cuts by the number of facets. Thats a lot. I observed that any given
- cut would acutally look like a cone (or cylinder if parallel). This
- reduces the number of objects tremdously and thus speeds ray tracing +
- smoother about the X axis. Unfortunately there is not much I can do
- with sharp edges of the cuts. The candle in particular doesn't seem to
- suffer. Be careful with curved surfaces. Once the scene is layed out,
- you may want to switch to RAW output which produces the best smoothed
- surfaces.
-
- For POVRAY the texture LatheWorkTex must be defined for the
- resulting object. See the included example .POV file. At the end of
- the file created by RayLathe are two #declare's (Location and Look_At)
- which are vector definitions for where to put the camera and where to
- aim the camera.
-
- To use them in POVRAY:
-
- Instead of: location <1 2 3> you can use: location Location
- look_at <3 2 1> look_at Look_At
-
-
- Usage: LAT2RAYL candle <- Converts uLathe CANDLE.LAT
- RAYLATHE <candle.dat >candle.inc <- Creates candle POVRAY object
- RAYLATHE -v <candle.dat >candle.vo <- Creates candle Vivid object
- Then create the scene (.pov or .v) and render.
-
-
- ADDITIONAL BOTHER:
-
- See also CHAIN (which generates a chain of links), SHADE (which
- generates pleated lamp shades), DIAMOND (which generates a cut gem,
- plus creates the rest of the .POV file: view, light, floor), GEAR
- (guess), STAR (which generates 3D stars with several attributes),
- FNT2POV (which converts Grasp/Pictor/compatible fonts to objects using
- many options), and SHP2DKB (which should become SHP2PV) which takes
- AutoCad .SHP font files and generates stroke-type font objects. At
- this time all of the programs listed in this paragraph are for POVRAY
- only.
-
-
-
-
-
- With all of these programs, just play around with the variables to
- generate new shapes. For example, generating many long points on the
- star looks like the spokes of a bicycle wheel. Many short points on a
- large radius star looks like a circular saw blade. Use your
- imagination and please post any ideas or neat works (with source) for
- the world to enjoy. As you can tell I don't like building single
- objects; I'd rather build a factory that can spit out 'what if' objects.
-
- Trial size soap box: Please include source when sending programs
- or objects. Even if its sloppy, it can only help others. Follow the
- lead of the people who brought us DKB in the first place. We wouldn't
- have a POVRAY now otherwise! Many thanks to those who do post!
-
- I can be reached at YOU CAN CALL ME RAY RBBS (708) 358-5611.
-
-
- "Its my world and you're welcome to it".
-
-
- Ken Koehler (7-21-93)
- CIS 72740,1161
- internet ken.koehler@pcohio.com
- Enclosed are these files:
-
- RAYLATHE.C C source
- RAYLATHE.EXE MS-DOS executable for object generator v2.00
- RAYLATHE.DOC This file
- LAT2RAYL.C C source
- LAT2RAYL.EXE uLathe .LAT to RayLathe .DAT converter v1.10
- CANDLE.LAT uLathe .LAT file containing shape data
- CANDLE.POV Sample POVRAY file to generate the test image
- SNIFTER.LAT uLathe .LAT file containing shape data
- SNIFTER.V Sample Vivid file to generate the test image
-
-
- Credits:
-
- Doug Downs (finally a local tracer! found on PC-OHIO) got me
- interested in uLathe (by Daniel S. Baker CompuServe: 71551,2300)
- which is a great (windows) modeler for lathing the objects. I was
- disappointed there was no way to export the data for ray tracing.
- Appearantly I got wound up enough to write this package. I'm into
- POVRAY, but Doug is into Vivid ("Tastes great, Less filling"). Doug
- graciously provides the Vivid testing and ideas.
-
- Eduard Schwan (as indicated in the revision history below) added
- POVRAY 2.0 support, made output prettier, and made the RayLathe code
- cleaner. Thanks for improvements!
-
-
-
-
-
- Revision History:
-
- 03-24-93 1.00 KJK New. Inspired by uLathe.
- 03-28-93 1.01 KJK Attempting Vivid output for Doug Downs.
- 04-11-93 1.10 KJK Releasable Vivid output version.
- Noticed THICK in Vivid not supported! Must fix.
- 04-11-93 1.11 KJK Cured black speckles in POVRAY output.
- 04-14-93 1.12 KJK Allow 0 length cones (rings) for Vivid.
- 04-15-93 1.13 KJK Enable THICK for Vivid. Print line # of .DAT file for
- each element.
- 04-24-93 1.20 KJK Since they are necessary when thickness is used,
- simulate cone/rings for POVRAY.
- 07-20-93 2.00 esp Add POV-Ray 2.0 syntax, clean up cmdline parsing,
- add Macintosh (MPW) support, change FP compares like
- (x==y) to (fabs(x-y) < EPSILON) to better conform to
- the way fp numbers (mis)behave, add tabwidth parm,
- clean up indenting.
- KJK Added RAW output format. Allow color input data for
- RAW output. May support color for POVRAY/Vivid if
- anyone cares. Currently POVRAY and Vivid ignore it.
- 09-18-93 2.10 KJK Fix bug: Commas introduced by esp tabbing where they
- didn't belong.